﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" 
    Theme="Theme1"
    EnableTheming="true"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="CityName" DataSourceID="SqlDataSource1"  SkinID="gridviewSkin"
            EmptyDataText="There are no data records to display.">
            <Columns>
                <asp:BoundField DataField="CityName" HeaderText="CityName" ReadOnly="True" 
                    SortExpression="CityName" />
                <asp:BoundField DataField="Latitude" HeaderText="Latitude" 
                    SortExpression="Latitude" />
                <asp:BoundField DataField="Longitude" HeaderText="Longitude" 
                    SortExpression="Longitude" />
                <asp:BoundField DataField="Country" HeaderText="Country" 
                    SortExpression="Country" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString1 %>" 
            DeleteCommand="DELETE FROM [CityData] WHERE [CityName] = @CityName" 
            InsertCommand="INSERT INTO [CityData] ([CityName], [Latitude], [Longitude], [Country]) VALUES (@CityName, @Latitude, @Longitude, @Country)" 
            ProviderName="<%$ ConnectionStrings:AdventureWorksConnectionString1.ProviderName %>" 
            SelectCommand="SELECT [CityName], [Latitude], [Longitude], [Country] FROM [CityData]" 
            UpdateCommand="UPDATE [CityData] SET [Latitude] = @Latitude, [Longitude] = @Longitude, [Country] = @Country WHERE [CityName] = @CityName">
            <DeleteParameters>
                <asp:Parameter Name="CityName" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="CityName" Type="String" />
                <asp:Parameter Name="Latitude" Type="Double" />
                <asp:Parameter Name="Longitude" Type="Double" />
                <asp:Parameter Name="Country" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Latitude" Type="Double" />
                <asp:Parameter Name="Longitude" Type="Double" />
                <asp:Parameter Name="Country" Type="String" />
                <asp:Parameter Name="CityName" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
